﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:generated="clr-namespace:ShredTheLog.Api;assembly=ShredTheLog.Generated"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    xmlns:tk="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    xmlns:dgp="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="FlashMisc2.xaml"/>
        <ResourceDictionary Source="FlashMessagesScrollBar.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate DataType="{x:Type generated:Language}">
        <TextBlock Text="{Binding Converter={x:Static cnv:LanguagesConverter.Default}}"/>
    </DataTemplate>

    <DataTemplate DataType="{x:Type generated:Country}">
        <TextBlock Text="{Binding Converter={x:Static cnv:CountryConverter.Default}}"/>
    </DataTemplate>

    <DataTemplate DataType="{x:Type generated:Gender}">
        <Image x:Name="image" Width="12" Height="12"/>
        
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding}" Value="Male">
                <Setter TargetName="image" Property="Source" Value="{StaticResource MaleImage}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding}" Value="Female">
                <Setter TargetName="image" Property="Source" Value="{StaticResource FemaleImage}"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <Style x:Key="FocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <c:MultiBorder Margin="-2" BorderThickness="2">
                        <c:MultiBorder.LeftBorderBrush>
                            <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                <GradientStop Offset="0" Color="#CDF3BE"/>
                                <GradientStop Offset="1" Color="#B6F69C"/>
                            </LinearGradientBrush>
                        </c:MultiBorder.LeftBorderBrush>
                        <c:MultiBorder.TopBorderBrush>
                            <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                <GradientStop Offset="0" Color="#DDF0D5"/>
                                <GradientStop Offset="1" Color="#C2F5AE"/>
                            </LinearGradientBrush>
                        </c:MultiBorder.TopBorderBrush>
                        <c:MultiBorder.RightBorderBrush>
                            <LinearGradientBrush StartPoint="1, 0.5" EndPoint="0, 0.5">
                                <GradientStop Offset="0" Color="#CDF3BE"/>
                                <GradientStop Offset="1" Color="#B6F69C"/>
                            </LinearGradientBrush>
                        </c:MultiBorder.RightBorderBrush>
                        <c:MultiBorder.BottomBorderBrush>
                            <LinearGradientBrush StartPoint="0.5, 1" EndPoint="0.5, 0">
                                <GradientStop Offset="0" Color="#DDF0D5"/>
                                <GradientStop Offset="1" Color="#C2F5AE"/>
                            </LinearGradientBrush>
                        </c:MultiBorder.BottomBorderBrush>
                    </c:MultiBorder>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type FlowDocument}">
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>

    <Style TargetType="{x:Type tk:DataGrid}">
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="IsSynchronizedWithCurrentItem" Value="True"/>
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="RowHeaderStyle" Value="{x:Null}"/>
        <Setter Property="RowHeaderWidth" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type tk:DataGrid}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <ScrollViewer Focusable="false" Name="DG_ScrollViewer">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>

                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>

                                        <!--Left Column Header Corner -->
                                        <!--<Button Command="{x:Static dg:DataGrid.SelectAllCommand}" Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}, Path=CellsPanelHorizontalOffset}" Template="{StaticResource SelectAllButtonTemplate}" Focusable="false" Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}, Path=HeadersVisibility, Converter={x:Static tk:DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static tk:DataGridHeadersVisibility.All}}" />-->
                                        
                                        <!--Column Headers-->
                                        <dgp:DataGridColumnHeadersPresenter Grid.Column="1" Name="PART_ColumnHeadersPresenter" Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}, Path=HeadersVisibility, Converter={x:Static tk:DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static tk:DataGridHeadersVisibility.Column}}"/>

                                        <!--DataGrid content-->
                                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.Row="1" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" />

                                        <ScrollBar Grid.Row="1" Grid.Column="2" Name="PART_VerticalScrollBar" Orientation="Vertical" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{Binding Path=VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>

                                        <Grid Grid.Row="2" Grid.Column="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}, Path=NonFrozenColumnsViewportHorizontalOffset}"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar Grid.Column="1" Name="PART_HorizontalScrollBar" Orientation="Horizontal" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Value="{Binding Path=HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="c:Extensions.IsCustomSortingEnabled" Value="True"/>

        <Setter Property="Background" Value="{StaticResource LightGrayBackgroundBrush}"/>
        <Setter Property="RowBackground" Value="#F0F2F4"/>
        <Setter Property="AlternatingRowBackground" Value="#F6F8FA"/>
        <Setter Property="GridLinesVisibility" Value="Vertical"/>
        <Setter Property="VerticalGridLinesBrush" Value="#C4D0EF"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="#919999"/>
        <Setter Property="Effect" Value="{StaticResource SmallShadow}"/>
    </Style>

    <Style TargetType="{x:Type ProgressBar}">
        <Setter Property="Minimum" Value="0"/>
        <Setter Property="Maximum" Value="360"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ProgressBar}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Image>
                                <Image.Resources>
                                    <s:Double x:Key="radius">0.35</s:Double>
                                </Image.Resources>
                                <Image.Source>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <GeometryDrawing>
                                                <GeometryDrawing.Pen>
                                                    <Pen Brush="Gray" Thickness="0.05"/>
                                                </GeometryDrawing.Pen>
                                                <GeometryDrawing.Brush>
                                                    <RadialGradientBrush RadiusX="1" RadiusY="1" GradientOrigin="1, 0.5">
                                                        <RadialGradientBrush.Transform>
                                                            <RotateTransform x:Name="lightDirection" Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"/>
                                                        </RadialGradientBrush.Transform>
                                                        <GradientStop Offset="0" Color="White"/>
                                                        <GradientStop Offset="0.1" Color="White"/>
                                                        <GradientStop Offset="1" Color="Black"/>
                                                    </RadialGradientBrush>
                                                </GeometryDrawing.Brush>
                                                <GeometryDrawing.Geometry>
                                                    <GeometryGroup>
                                                        <EllipseGeometry Center="1, 0" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="0.70710678118654752440084436210485, -0.70710678118654752440084436210485" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="0, -1" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="-0.70710678118654752440084436210485, -0.70710678118654752440084436210485" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="-1, 0" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="-0.70710678118654752440084436210485, 0.70710678118654752440084436210485" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="0, 1" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                        <EllipseGeometry Center="0.70710678118654752440084436210485, 0.70710678118654752440084436210485" RadiusX="{StaticResource radius}" RadiusY="{StaticResource radius}"/>
                                                    </GeometryGroup>
                                                </GeometryDrawing.Geometry>
                                            </GeometryDrawing>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Image.Source>
                            </Image>

                            <Rectangle x:Name="DisabledVisualElement" Fill="White" IsHitTestVisible="False" Opacity="0.5" Visibility="Collapsed"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="DisabledVisualElement" Value="Visible"/>
                        </Trigger>
                        
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsIndeterminate" Value="True"/>
                                <Condition Property="Visibility" Value="Visible"/>
                            </MultiTrigger.Conditions>
                            <TriggerBase.EnterActions>
                                <BeginStoryboard x:Name="Indeterminate">
                                    <Storyboard RepeatBehavior="Forever">
                                        <DoubleAnimation Storyboard.TargetName="lightDirection" Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:0.5" RepeatBehavior="Forever"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </TriggerBase.EnterActions>
                            <TriggerBase.ExitActions>
                                <StopStoryboard BeginStoryboardName="Indeterminate"/>
                            </TriggerBase.ExitActions>
                        </MultiTrigger>
                        
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Padding" Value="0, 0, 0, 1"/>
        <Setter Property="Background" Value="#F8F8F8"/>
        <Setter Property="Foreground" Value="#0B333C"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid x:Name="Grid">
                        <Border x:Name="outerBorder" Background="White" CornerRadius="4" BorderBrush="#919999" BorderThickness="1">
                            <Border x:Name="innerBorder" Background="{TemplateBinding Background}" Margin="1" CornerRadius="2" BorderBrush="#D2DADA" BorderThickness="1">
                                <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/>
                            </Border>
                        </Border>

                        <Rectangle x:Name="DisabledVisualElement" Fill="White" IsHitTestVisible="False" Opacity="0.5" Visibility="Collapsed"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDefault" Value="True">
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#89CC73"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#ADEC93"/>
                        </Trigger>

                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#89CC73"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#ADEC93"/>
                        </Trigger>

                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#89CC73"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#ADEC93"/>
                        </Trigger>

                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#8AC27A"/>
                            <Setter TargetName="outerBorder" Property="Background" Value="#A5FE80"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#B1E49C"/>
                            <Setter TargetName="innerBorder" Property="Background" Value="#E6FFDB"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Visibility" TargetName="DisabledVisualElement" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TextBoxStyle" TargetType="{x:Type Control}">
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Foreground" Value="#0B333C"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control}">
                    <Grid>
                        <c:MultiBorder Background="{TemplateBinding Background}" BorderThickness="2, 3, 2, 3">
                            <c:MultiBorder.LeftBorderBrush>
                                <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                    <GradientStop Offset="0" Color="#919999"/>
                                    <GradientStop Offset="1" Color="#D5DDDD"/>
                                </LinearGradientBrush>
                            </c:MultiBorder.LeftBorderBrush>
                            <c:MultiBorder.TopBorderBrush>
                                <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                    <GradientStop Offset="0" Color="#AEB2B2"/>
                                    <GradientStop Offset="0.5" Color="#99A1A1"/>
                                    <GradientStop Offset="1" Color="#E1E5E5"/>
                                </LinearGradientBrush>
                            </c:MultiBorder.TopBorderBrush>
                            <c:MultiBorder.RightBorderBrush>
                                <LinearGradientBrush StartPoint="1, 0.5" EndPoint="0, 0.5">
                                    <GradientStop Offset="0" Color="#919999"/>
                                    <GradientStop Offset="1" Color="#D5DDDD"/>
                                </LinearGradientBrush>
                            </c:MultiBorder.RightBorderBrush>
                            <c:MultiBorder.BottomBorderBrush>
                                <LinearGradientBrush StartPoint="0.5, 1" EndPoint="0.5, 0">
                                    <GradientStop Offset="0" Color="#E1E5E5"/>
                                    <GradientStop Offset="0.5" Color="#E1E5E5"/>
                                    <GradientStop Offset="1" Color="#F6F6F6"/>
                                </LinearGradientBrush>
                            </c:MultiBorder.BottomBorderBrush>

                            <ScrollViewer Margin="0" x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}"/>
                        </c:MultiBorder>

                        <Rectangle x:Name="DisabledVisualElement" Fill="White" IsHitTestVisible="False" Opacity="0.5" Visibility="Collapsed"/>
                    </Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Visibility" TargetName="DisabledVisualElement" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxStyle}"/>
    <Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource TextBoxStyle}"/>

    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Foreground" Value="#505DBF"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Padding" Value="4,1,0,0"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <Grid>
                        <BulletDecorator Background="Transparent">
                            <BulletDecorator.Bullet>
                                <Border x:Name="outerBorder" BorderThickness="1">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush StartPoint="0, 0" EndPoint="1, 1">
                                            <GradientStop Offset="0" Color="#CCCCCC"/>
                                            <GradientStop Offset="0.499" Color="#CCCCCC"/>
                                            <GradientStop Offset="0.501" Color="#777777"/>
                                            <GradientStop Offset="1" Color="#777777"/>
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                    <Border x:Name="innerBorder" BorderThickness="1" BorderBrush="White" Background="#F0F0F0">
                                        <Path x:Name="checkIcon" Width="8" Height="8" Fill="#2B333C" Stretch="Fill" Opacity="1" Visibility="Hidden" Data="M103.78572,598.96112 L105.09846,597.5661 L107.00806,600.16229 C107.00806,600.16229 109.91004,592.74463 109.91004,592.74463 C109.91004,592.74463 111.74678,593.79761 111.74678,593.79761 C111.74678,593.79761 107.88566,602.75848 107.88566,602.75848 L106.60118,602.75848 z"/>
                                    </Border>
                                </Border>
                            </BulletDecorator.Bullet>
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                        </BulletDecorator>

                        <Rectangle x:Name="DisabledVisualElement" Fill="White" IsHitTestVisible="False" Opacity="0.5" Visibility="Collapsed"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="checkIcon" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="outerBorder" Property="BorderBrush">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0, 0" EndPoint="1, 1">
                                        <GradientStop Offset="0" Color="#B9D8AC"/>
                                        <GradientStop Offset="0.5" Color="#B9D8AC"/>
                                        <GradientStop Offset="0.51" Color="#6C8B5F"/>
                                        <GradientStop Offset="1" Color="#6C8B5F"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#DAF9CD"/>
                            <Setter TargetName="innerBorder" Property="Background" Value="#F7F7F7"/>
                        </Trigger>

                        <Trigger Property="IsThreeState" Value="True">
                            <Setter TargetName="checkIcon" Property="Opacity" Value="0.5"/>
                        </Trigger>

                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="outerBorder" Property="BorderBrush">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0, 0" EndPoint="1, 1">
                                        <GradientStop Offset="0" Color="#A6E58C"/>
                                        <GradientStop Offset="0.5" Color="#A6E58C"/>
                                        <GradientStop Offset="0.51" Color="#59983F"/>
                                        <GradientStop Offset="1" Color="#59983F"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#F0F6ED"/>
                            <Setter TargetName="innerBorder" Property="Background" Value="White"/>
                        </Trigger>

                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#E0FFD3"/>
                            <Setter TargetName="innerBorder" Property="Background" Value="#D4F3C7"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Visibility" TargetName="DisabledVisualElement" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ComboBox}">
        <Style.Resources>
            <Style TargetType="{x:Type ComboBoxItem}">
                <Setter Property="Padding" Value="3" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                            <Border x:Name="border" Background="Transparent">
                                <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsHighlighted" Value="true">
                                </Trigger>

                                <Trigger Property="Selector.IsSelected" Value="True">
                                    <Setter TargetName="border" Property="Background" Value="#CDFFC1"/>
                                </Trigger>

                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="border" Property="Background" Value="#E3FFD6"/>
                                </Trigger>

                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Foreground" Value="#0B333C"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <ControlTemplate.Resources>
                        <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
                            <Grid>
                                <Border Background="White" BorderThickness="2" CornerRadius="4">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                            <GradientStop Offset="0" Color="#D6D6D6"/>
                                            <GradientStop Offset="1" Color="#C0C0C0"/>
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                </Border>
                                <Border x:Name="BtnOverlay" Width="20" CornerRadius="0, 4, 4, 0" HorizontalAlignment="Right" BorderThickness="2" Background="#F7F7F7">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                            <GradientStop Offset="0" Color="#E3E3E3"/>
                                            <GradientStop Offset="1" Color="#C4C4C4"/>
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                </Border>
                                <Path x:Name="BtnArrow" Margin="0,0,7,0" Width="6" Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z " HorizontalAlignment="Right" Stretch="Uniform" Fill="#2B333C"/>
                                <Border x:Name="PressedBorder" Width="20" CornerRadius="0, 4, 4, 0" HorizontalAlignment="Right" Background="#3080FF80" Visibility="Collapsed"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="BtnOverlay" Property="BorderBrush">
                                        <Setter.Value>
                                            <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                                <GradientStop Offset="0" Color="#D5F2C9"/>
                                                <GradientStop Offset="1" Color="#BBD1B2"/>
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>

                                <Trigger Property="IsChecked" Value="true">
                                    <Setter TargetName="PressedBorder" Property="Visibility" Value="Visible"/>
                                </Trigger>

                                <Trigger Property="IsPressed" Value="True">
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </ControlTemplate.Resources>
                    <Grid>
                        <ToggleButton Template="{StaticResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
                        <ContentPresenter HorizontalAlignment="Left" Margin="6,3,23,3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/>
                        <TextBox Visibility="Hidden" HorizontalAlignment="Stretch" Margin="3,0,23,0" x:Name="PART_EditableTextBox" VerticalAlignment="Center" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}">
                            <TextBox.Template>
                                <ControlTemplate TargetType="{x:Type TextBox}">
                                    <ScrollViewer Margin="0" x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}"/>
                                </ControlTemplate>
                            </TextBox.Template>
                        </TextBox>
                        <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" PopupAnimation="Slide" AllowsTransparency="True">
                            <Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown">
                                <Border x:Name="DropDownBorder" Background="White" BorderBrush="#BBBBBB" BorderThickness="2">
                                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                    </ScrollViewer>
                                </Border>
                            </Grid>
                        </Popup>
                        <Rectangle x:Name="DisabledVisualElement" Fill="White" IsHitTestVisible="False" Opacity="0.5" Visibility="Collapsed"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                        </Trigger>

                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="MinHeight" Value="95" TargetName="DropDownBorder"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Visibility" TargetName="DisabledVisualElement" Value="Visible"/>
                        </Trigger>

                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>

                        <Trigger Property="IsEditable" Value="true">
                            <Setter Property="IsTabStop" Value="false"/>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_EditableTextBox"/>
                            <Setter Property="Visibility" Value="Hidden" TargetName="ContentSite"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <ControlTemplate.Resources>
                        <Style x:Key="ArrowButton" TargetType="{x:Type RepeatButton}">
                            <Setter Property="Focusable" Value="False"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                                        <Grid>
                                            <Border x:Name="border1" BorderThickness="1" CornerRadius="0, 0, 3, 3">
                                                <Border.BorderBrush>
                                                    <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                        <GradientStop Offset="0" Color="#9A9A9A"/>
                                                        <GradientStop Offset="1" Color="#D6D6D6"/>
                                                    </LinearGradientBrush>
                                                </Border.BorderBrush>
                                                <Border.Background>
                                                    <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                        <GradientStop Offset="0" Color="#FBFBFB"/>
                                                        <GradientStop Offset="1" Color="#EBEBEB"/>
                                                    </LinearGradientBrush>
                                                </Border.Background>
                                                <Viewbox x:Name="content" Margin="4">
                                                    <Path Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" IsHitTestVisible="False" Fill="#2B333C"/>
                                                </Viewbox>
                                            </Border>
                                            <Border x:Name="border2" BorderThickness="0" CornerRadius="0, 0, 3, 3" Background="#A0F0A0" Opacity="0"/>
                                        </Grid>

                                        <ControlTemplate.Triggers>
                                            <Trigger Property="Tag" Value="Down">
                                                <Setter TargetName="border1" Property="CornerRadius" Value="3, 3, 0, 0"/>
                                                <Setter TargetName="border2" Property="CornerRadius" Value="3, 3, 0, 0"/>
                                                <Setter TargetName="content" Property="LayoutTransform">
                                                    <Setter.Value>
                                                        <RotateTransform Angle="180"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>

                                            <Trigger Property="IsMouseOver" Value="true">
                                                <Setter TargetName="border1" Property="BorderBrush">
                                                    <Setter.Value>
                                                        <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                            <GradientStop Offset="0" Color="#80AB6E"/>
                                                            <GradientStop Offset="1" Color="#B9E8A6"/>
                                                        </LinearGradientBrush>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>

                                            <Trigger Property="IsPressed" Value="true">
                                                <Setter TargetName="border1" Property="Background">
                                                    <Setter.Value>
                                                        <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                            <GradientStop Offset="0" Color="LightGray"/>
                                                            <GradientStop Offset="1" Color="White"/>
                                                        </LinearGradientBrush>
                                                    </Setter.Value>
                                                </Setter>
                                                <Setter TargetName="border2" Property="Opacity" Value="0.4"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>

                        <Style x:Key="TrackButton" TargetType="{x:Type RepeatButton}">
                            <Setter Property="Focusable" Value="False"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                                        <Rectangle Fill="Transparent"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ControlTemplate.Resources>

                    <Grid x:Name="GridRoot" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
                        <Grid.RowDefinitions>
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                        </Grid.RowDefinitions>

                        <Rectangle Grid.RowSpan="3" StrokeThickness="1">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                    <GradientStop Offset="0" Color="#EAEAEA"/>
                                    <GradientStop Offset="0.333" Color="White"/>
                                    <GradientStop Offset="1" Color="White"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                    <GradientStop Offset="0" Color="#CCCCCC"/>
                                    <GradientStop Offset="1" Color="#EEEEEE"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                        </Rectangle>

                        <RepeatButton x:Name="DecreaseRepeat" Style="{DynamicResource ArrowButton}" Command="ScrollBar.LineUpCommand" Tag="Up"/>

                        <Track Grid.Row="1" x:Name="PART_Track" Orientation="Vertical" IsDirectionReversed="true">
                            <Track.Thumb>
                                <Thumb Focusable="False">
                                    <Thumb.Template>
                                        <ControlTemplate TargetType="{x:Type Thumb}">
                                            <Border Margin="1, 0, 1, 0" CornerRadius="0, 3, 3, 0" BorderThickness="0, 1, 1, 1" Background="Transparent">
                                                <Border.BorderBrush>
                                                    <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                        <GradientStop Offset="0" Color="#D9D9D9"/>
                                                        <GradientStop Offset="1" Color="#9A9A9A"/>
                                                    </LinearGradientBrush>
                                                </Border.BorderBrush>

                                                <Grid VerticalAlignment="Stretch" Margin="4, 1, 4, 1">
                                                    <Panel.Resources>
                                                        <LinearGradientBrush x:Key="stroke" StartPoint="0, 0.5" EndPoint="1, 0.5">
                                                            <GradientStop Offset="0" Color="#DCDFDF"/>
                                                            <GradientStop Offset="0.2" Color="#BFC6C6"/>
                                                            <GradientStop Offset="0.8" Color="#BFC6C6"/>
                                                            <GradientStop Offset="1" Color="#DCDFDF"/>
                                                        </LinearGradientBrush>
                                                    </Panel.Resources>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition MaxHeight="1"/>
                                                        <RowDefinition Height="*"/>
                                                    </Grid.RowDefinitions>
                                                    <Rectangle Grid.Row="1" Fill="{StaticResource stroke}"/>
                                                    <Rectangle Grid.Row="3" Fill="{StaticResource stroke}"/>
                                                    <Rectangle Grid.Row="5" Fill="{StaticResource stroke}"/>
                                                    <Rectangle Grid.Row="7" Fill="{StaticResource stroke}"/>
                                                </Grid>
                                            </Border>
                                        </ControlTemplate>
                                    </Thumb.Template>
                                </Thumb>
                            </Track.Thumb>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Style="{StaticResource TrackButton}"/>
                            </Track.IncreaseRepeatButton>
                            <Track.DecreaseRepeatButton>
                                <RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Style="{StaticResource TrackButton}"/>
                            </Track.DecreaseRepeatButton>
                        </Track>

                        <RepeatButton Grid.Row="2" x:Name="IncreaseRepeat" Style="{DynamicResource ArrowButton}" Command="ScrollBar.LineDownCommand" Tag="Down"/>

                        <Rectangle x:Name="DisabledElement" Grid.RowSpan="3" Fill="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0.5" IsHitTestVisible="False" Visibility="Collapsed"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Horizontal">
                            <Setter Property="LayoutTransform" TargetName="GridRoot">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>

                            <Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/>

                            <Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeat"/>
                            <Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeat"/>
                            <Setter Property="Command" Value="ScrollBar.PageLeftCommand" TargetName="PageDown"/>
                            <Setter Property="Command" Value="ScrollBar.PageRightCommand" TargetName="PageUp"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="DisabledElement" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type c:AutoScrollViewer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <ScrollContentPresenter Grid.Column="0" Grid.Row="0" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}"/>

                        <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="1" x:Name="PART_HorizontalScrollBar" Orientation="Horizontal" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" AutomationProperties.AutomationId="HorizontalScrollBar"/>
                        <Border Grid.Column="1" Grid.Row="0" Padding="1, 20, 1, 20" BorderThickness="1" BorderBrush="#999999" Margin="0, -1, -1, -1">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                    <GradientStop Offset="0" Color="#C5CBD9"/>
                                    <GradientStop Offset="1" Color="#EBEEF2"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" x:Name="PART_VerticalScrollBar" Orientation="Vertical" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" AutomationProperties.AutomationId="VerticalScrollBar" Style="{StaticResource MessagesScrollBar}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>